package com.zhangshuo.patternDesign.singleton;

/**
 * Created by shuo.zhang on 2017-10-17.
 */
public class Singleton2 {

    private Singleton2(){}

    private static class InstanceClass{
        //加载内部类的时候才会初始化变量
        private static Singleton2 instance = new Singleton2();
    }

    public static Singleton2 getInstance(){
        return InstanceClass.instance;
    }

}
